package cn.baimo.mapper;

import cn.baimo.pojo.Hospital;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface HospitalMapper {
    //查询热门医院
    @Select("select * from hospital LIMIT 3")
    List<Hospital> selectHotHospitals();
    //查询其他医院
    @Select("select * from hospital LIMIT 3,6")
    List<Hospital> selectHospitalsSix();
    //查询医院总数
    @Select("select count(1) from hospital")
    int selectHospitalTotalNum();
    //通过医生id查询医院
    @Select("select h.* FROM doctor d,hospital h,hospital_division hd WHERE d.hdid=hd.id  and hd.hid =h.id and d.id=#{id}")
    Hospital selectHospitalByDoctorId(int id);
    //通过医院id查询医院
    @Select("select * FROM hospital WHERE id=#{id}")
    Hospital selectHospitalByHospitalId(int id);
    //通过条件查询医院
    List<Hospital> selectHospitals(@Param("hospital") Hospital hospital,@Param("order") String order);
}
